local yaowu = fk.CreateSkill{
    name = "ym2__yaowu",
}
Fk:loadTranslationTable{
    ["ym2__yaowu"] = "药妩",
    [":ym2__yaowu"] = "你的首回合开始时，你使用五张不同副类别的【女装】。你失去装备区内一张牌后，可以赠予之并将手牌摸至体力上限张。",
    ["#ym2__yaowu-present"] = "是否发动 药妩，赠予 %arg 并将手牌摸至体力上限",
}
local U = require "packages/utility/utility"
local yaowu__women_dress = {
    { "ym_yaowu3__women_dress", Card.Heart, 9  },
    { "ym_yaowu4__women_dress", Card.Heart, 10 },
    { "ym_yaowu5__women_dress", Card.Heart, 11 },
    { "ym_yaowu6__women_dress", Card.Heart, 12 },
    { "ym_yaowu7__women_dress", Card.Heart, 13 },
}

yaowu:addEffect(fk.TurnStart, {
    anim_type = "support",
    can_trigger = function (self, event, target, player, data)
        return target == player and player:hasSkill(yaowu.name) and
        player:usedSkillTimes(yaowu.name, Player.HistoryGame) == 0 and
        #player.room.logic:getEventsOfScope(GameEvent.Turn, 2, function (e)
            return e.data.who == player
        end, Player.HistoryGame) == 1
    end,
    on_cost = Util.TrueFunc,
    on_use = function (self, event, target, player, data)
        local room = player.room
        for i = 1, 5, 1 do
            local id = U.prepareDeriveCards(room, yaowu__women_dress, yaowu__women_dress[i][1])[i]
            room:moveCardTo(id,Card.Void,nil,fk.ReasonJustMove,yaowu.name)
            local card = Fk:getCardById(id)
            --if player:canUseTo(card, player) then
                room:useCard{
                    from = player,
                    tos = { player },
                    card = card,
                }
            --end
        end
    end,
})
yaowu:addEffect(fk.AfterCardsMove,{
    can_trigger = function (self, event, target, player, data)
        if player:hasSkill(yaowu.name) then
            for _, move in ipairs(data) do
                if move.from == player then
                    for _, info in ipairs(move.moveInfo) do
                        if info.fromArea == Card.PlayerEquip then
                            return true
                        end
                    end
                end
            end
        end
    end,
    on_trigger = function(self, event, target, player, data)
        for _, move in ipairs(data) do
            if move.from == player then
                for _, info in ipairs(move.moveInfo) do
                    if info.fromArea == Card.PlayerEquip then
                        event:setCostData(self,{card = info.cardId})
                        self:doCost(event, target, player, data)
                    end
                end
            end
        end
    end,
    on_cost = function (self, event, target, player, data)
        local room = player.room
        local card = Fk:getCardById(event:getCostData(self).card)
        local targets = room:getOtherPlayers(player)
        local to = room:askToChoosePlayers(player, {
            targets = targets,
            min_num = 1,
            max_num = 1,
            skill_name = yaowu.name,
            prompt = "#ym2__yaowu-present:::"..card:toLogString(),
            cancelable = true,
        })
        if #to > 0 then
            event:setCostData(self, { card = card, to = to[1] })
            return true
        end
    end,
    on_use = function (self, event, target, player, data)
        local card = event:getCostData(self).card
        local to = event:getCostData(self).to
        U.presentCard(player, to, card, yaowu.name)
        if (player.maxHp - player:getHandcardNum()) > 0 then
            player:drawCards(player.maxHp - player:getHandcardNum(), yaowu.name)
        end
    end,
})
return yaowu